<%@ page import="entity.Commodity" %>
<%@ page import="controller.CommodityListController" %><%--
  Created by IntelliJ IDEA.
  User: 浮犴兮
  Date: 2022/3/20
  Time: 10:14
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>商品列表页面</title>
    <style>
        table {
            margin: 80px auto 0 auto;
            border: 1px black solid;
            font-size: 24px;
            border-spacing:0;
            border-top:1px solid black;
            border-left: 1px solid black;
        }
        table thead{
            table-layout:fixed;
            background-color: #F45B4B;
            /*display: table;*/
            width: 100%;
        }
        table body{
            /*display: table;*/
            height: 420px;
            overflow-y: scroll;
        }

        .tdStyle td {
            padding: 10px;
            border-right: 1px solid black;
            border-bottom: 1px solid black;
            border-collapse: collapse;
        }
    </style>
</head>
<body>
<a href="login.html" style="color: #F45B4B;font-size: 24px;margin-top:30px;padding-left: 35px">⬅返回登陆页面</a>
<div align="center" style="margin-top: 60px">
    <form action="/CommodityListController" method="get">
        <input type="hidden" name="method" value="search"/>
        <label style="font-size: 24px">选择查询方式为</label>
        <select name="searchMethod" style="font-size: 24px">
            <option value="商品条形码">商品条形码</option>
            <option value="商品名称">商品名称</option>
        </select>
        <input type="text" name="key" size="24px" style="font-size: 24px">
        <button style="margin-top: 5px;margin-bottom:10px;font-size: 24px">搜索</button>
        <button formmethod="post" style="margin-top: 5px;margin-bottom:10px;font-size: 24px">展示所有商品</button>
    </form>
</div>
<div id="main" style="height: 400px;overflow-y: scroll">
    <table class="tdStyle" style="height: 100px">
        <thead>
        <tr>
            <td>商品条形码</td>
            <td>商品名称</td>
            <td>商品类型</td>
            <td>商品价格</td>
            <td>修改操作按钮</td>
            <td>删除商品按钮</td>
            <td>购物车选项</td>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${requestScope.Commodity}" var="commodity">
            <tr>
                <td>${commodity.cId}</td>
                <td>${commodity.cName}</td>
                <td>${commodity.cKind}</td>
                <td>${commodity.cPrice}</td>
                <td><a href="/CommodityListController?method=toUpdate&cId=${commodity.cId}"><img src="modify.png"
                                                                                                 style="margin-left: 45px"
                                                                                                 width="56"
                                                                                                 height="51"></a></td>
                <td><a href="/CommodityListController?method=toDelete&cId=${commodity.cId}"><img src="delete.png"
                                                                                                 style="margin-left: 45px"
                                                                                                 width="56"
                                                                                                 height="64"></a></td>
                <td><a href="CommodityListController?method=toShoppingCar&cId=${commodity.cId}"><img
                        src="shoppingcar.png" style="margin-left: 20px" height="62" width="72"></a></td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>
<div align="center">
    <form action="/CommodityListController" method="get">
        <input type="hidden" name="method" value="toAdd"/>
        <button style="margin-top: 30px;font-size: 24px;">添加商品</button>
    </form>
    <form action="/CommodityListController" method="get">
        <input type="hidden" name="method" value="toCart"/>
        <button style="margin-top: 30px;font-size: 24px;">查看购物车</button>
    </form>
</div>

</body>
</html>
